import request from "./index.js"

// 根据id查询用户信息
export const getUserInfo = (params) => {
  // console.log('dddddd',params);
  return request({
    url: '/webapi/userinfo',
    method: 'GET',
    data: params,
    header: {
      'Authorization': uni.getStorageSync('token') || ''
    },
  })
}

// 用户登录
export const userLogin = (params) => {
  // console.log('dddddd',params);
  return request({
    url: '/api/webapi/login',
    method: 'POST',
    data: params,
    header: {},
  })
}
// 用户注册
export const userRegister = (params) => {
  // console.log('dddddd',params);
  return request({
    url: '/api/webapi/reguser',
    method: 'POST',
    data: params,
    header: {},
  })
}
// 更换头像
export const uploadUserImg = (params) => {
  // console.log('dddddd', params);
  return request({
    url: '/api/webapi/reguser',
    method: 'POST',
    data: params,
    header: {
      'Authorization': uni.getStorageSync('token') || ''
    },
  })
}

// 更换昵称
export const uploadUserName = (params) => {
  // console.log('dddddd', params);
  return request({
    url: '/webapi/updateUserinfo',
    method: 'POST',
    data: params,
    header: {
      'Authorization': uni.getStorageSync('token') || ''
    },
  })
}

// 更换密码
export const uploadPassword = (params) => {
  // console.log('dddddd', params);
  return request({
    url: '/webapi/updatepwd',
    method: 'POST',
    data: params,
    header: {
      'Authorization': uni.getStorageSync('token') || ''
    },
  })
}

// 根据用户id查询用户地址
export const getUserAddress = (params,id) => {
  // console.log('dddddd', params);
  return request({
    url: '/addressUser/' + id,
    method: 'GET',
    data: params,
    header: {
      'Authorization': uni.getStorageSync('token') || ''
    },
  })
}

// 用户添加地址
export const UserAddAddress = (params) => {
  // console.log('dddddd', params);
  return request({
    url: '/addressAdd',
    method: 'POST',
    data: params,
    header: {
      'Authorization': uni.getStorageSync('token') || ''
    },
  })
}

// 用户删除地址
export const UserRemoveAddress = (params,id) => {
  // console.log('dddddd', params);
  return request({
    url: '/addressDelete/' + id,
    method: 'DELETE',
    data: params,
    header: {
      'Authorization': uni.getStorageSync('token') || ''
    },
  })
}

// 获取轮播图数据
export const getSwiper = (params) => {
  // console.log('dddddd', params);
  return request({
    url: '/adminapi/bannerSelect',
    method: 'GET',
    data: params,
    header: {
      'Authorization': uni.getStorageSync('token') || ''
    },
  })
}

// 用户添加订单信息
export const AddOrder = (params) => {
  // console.log('dddddd', params);
  return request({
    url: '/orderAdd',
    method: 'POST',
    data: params,
    header: {
      'Authorization': uni.getStorageSync('token') || ''
    },
  })
}

// 用户提交接单申请
export const AddApply = (params) => {
  // console.log('dddddd', params);
  return request({
    url: '/applyAdd',
    method: 'POST',
    data: params,
    header: {
      'Authorization': uni.getStorageSync('token') || ''
    },
  })
}

// 根据学号查询申请接单信息
export const GetApply = (params) => {
  // console.log('dddddd', params);
  return request({
    url: '/adminapi/selectApply',
    method: 'POST',
    data: params,
    header: {
      'Authorization': uni.getStorageSync('token') || ''
    },
  })
}

// 用户提交建议
export const SubSuggest = (params) => {
  // console.log('dddddd', params);
  return request({
    url: '/proposalAdd',
    method: 'POST',
    data: params,
    header: {
      'Authorization': uni.getStorageSync('token') || ''
    },
  })
}

// 获取公告列表
export const getNotice = (params) => {
  // console.log('dddddd', params);
  return request({
    url: '/adminapi/getNoticeAll',
    method: 'GET',
    data: params,
    header: {
      'Authorization': uni.getStorageSync('token') || ''
    },
  })
}

// 获取所有订单列表
export const orderAll = (params) => {
  // console.log('dddddd', params);
  return request({
    url: '/adminapi/orderAll',
    method: 'GET',
    data: params,
    header: {
      'Authorization': uni.getStorageSync('token') || ''
    },
  })
}

// 根据id查询订单列表
export const orderStuNumAll = (params, id) => {
  // console.log('dddddd', params);
  return request({
    url: '/orderUserById/' + id,
    method: 'GET',
    data: params,
    header: {
      'Authorization': uni.getStorageSync('token') || ''
    },
  })
}

// 获取我帮助的订单列表   暂时失败!!!
export const getMyHelp = (params, id) => {
  // console.log('dddddd', params);
  // console.log('aaaaaaaaa', id);
  return request({
    url: '/orderReceivePersonById/' + id,
    method: 'GET',
    data: params,
    header: {
      'Authorization': uni.getStorageSync('token') || ''
    },
  })
}